﻿using System.Windows;
using System.Windows.Input;
using IS_Ever_Green.DataAccess;
using Microsoft.EntityFrameworkCore;

namespace IS_Ever_Green.View
{
    public partial class MainView : Window
    {
        public MainView()
        {
            InitializeComponent();
            EverGreenDBContext context = new EverGreenDBContext();
            context.Database.Migrate();
            Seed seed = new Seed();
            seed.ImportDataFromJson();
        }

        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed) DragMove();
        }

        private void btnClose_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }

        private void btnMinimize_Click(object sender, RoutedEventArgs e)
        {
            WindowState = WindowState.Minimized;
        }

        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            LoginView login = new();
            login.Show();
            this.Close();
        }

        private void btnRegister_Click(object sender, RoutedEventArgs e)
        {
            RegistrationView registration = new RegistrationView();
            registration.Show();
            this.Close();
        }
    }
}